home *** CD-ROM | disk | FTP | other *** search
- '-------------------------------------------------------------------------------------
- ' Program to create the virtual directory during installation
- ' Author : ASPFusion Support
- ' Company : Advanced Communications
- '-------------------------------------------------------------------------------------
- Option Explicit
- on error resume next
- Dim oArgs, ArgNum
- Dim iisObj,vObj,iisObj2,vObj2
- Dim sPath
- Dim VDirName
- Dim DefaultPage
- Dim IPRestrict
- Dim Account
- Set oArgs = WScript.Arguments
- if oArgs.Count < 1 then
- WScript.Echo "Invalid no of arguments" & CStr(oArgs.Count)
- else
- sPath = oArgs(0)
- VDirName = oArgs(1)
- DefaultPage = oArgs(2)
- Account = oArgs(3)
- IPRestrict = oArgs(4)
- Err.clear
- set iisObj = GetObject("IIS://localhost/w3svc/1/ROOT")
- if Err <> 0 then
- WScript.Echo "Error: IIS Object could not be obtained"
- WScript.Quit(1)
- end if
- Set vObj = iisObj.Create("IIsWebVirtualDir",VDirName)
- if Err <> 0 then
- WScript.Quit(1)
- else
- 'now set the attributes for the virtual directory
- vObj.Path = sPath
- vObj.SetInfo
- vObj.AccessRead = True
- vObj.AccessWrite = True
- vObj.AccessScript = True
- vObj.AccessExecute = True
- vObj.AuthAnonymous = True
- vObj.AppCreate "TRUE"
- vObj.AppFriendlyName = "ASPFusion"
- vObj.AnonymousPasswordSync = True
- if (Account <> "") then
- vObj.AnonymousUserName = Account
- end if
- vObj.EnableDefaultDoc = True
- vObj.DefaultDoc = DefaultPage
- vObj.SetInfo
- if Err <> 0 then
- WScript.Echo "Error: Could not set properties"
- WScript.Quit(1)
- end if
- 'now set the attributes for ip restriction
- if (IPRestrict <> "") then
- Dim currentobj, sobj,path
- dim proparray(0)
- path ="IIS://localhost/W3SVC/1/ROOT/"&VDirName
- proparray(0)=IPRestrict
- Set currentobj=GetObject(path)
- Set sobj=currentobj.IPSecurity
- sobj.GrantByDefault = FALSE
- sobj.IPGrant=(proparray)
- currentobj.IPSecurity=sobj
- currentobj.SetInfo
- end if
- end if
- end if